package system

import (
	"github.com/gogf/gf/v2/frame/g"
	"server/api"
	"server/internal/model"
)

type ConfigCategoryCreateReq struct {
	g.Meta `path:"/system/configCategory/create" tags:"系统管理-配置项分类" method:"post" summary:"新增" description:"新增系统配置项分类"`
	Name   string `v:"required"`
	Remark string `v:""`
}
type ConfigCategoryCreateRes struct {
	ID int64 `json:"id"`
}

type ConfigCategoryUpdateReq struct {
	g.Meta `path:"/system/configCategory/update" tags:"系统管理-配置项分类" method:"post" summary:"编辑" description:"编辑系统配置项分类"`
	ID     int64  `v:"required"`
	Name   string `v:"required"`
	Remark string `v:""`
}
type ConfigCategoryUpdateRes struct {
	Result int64 `json:"result"`
}

type ConfigCategoryDeleteReq struct {
	g.Meta `path:"/system/configCategory/delete" tags:"系统管理-配置项分类" method:"post" summary:"删除" description:"删除系统配置项分类"`
	ID     int64 `v:"required"`
}
type ConfigCategoryDeleteRes struct {
	Result int64 `json:"result"`
}

type ConfigCategoryListReq struct {
	g.Meta `path:"/system/configCategory/list" tags:"系统管理-配置项" method:"GET" summary:"列表" description:"配置项列表"`
	api.PagerReq
	Code string `dc:"标识符"`
	Name string `dc:"名称"`
}
type ConfigCategoryListRes struct {
	Total int                                  `json:"total"`
	List  []model.SystemConfigCategoryListItem `json:"list"`
}

type ConfigCreateReq struct {
	g.Meta        `path:"/system/config/create" tags:"系统管理-配置项" method:"post" summary:"新增" description:"角色用于关联用户、菜单栏、权限"`
	CategoryID    int64  `v:""`
	Name          string `v:"required"`
	Code          string `v:"required"`
	Content       string `v:""`
	Remark        string `v:""`
	IsAllowDelete int64  `v:""` // 是否允许删除：1-允许删除；0-不允许删除
}
type ConfigCreateRes struct {
	Id int64 `json:"id"`
}

type ConfigUpdateReq struct {
	g.Meta        `path:"/system/config/update" tags:"系统管理-配置项" method:"post" summary:"修改" description:"修改配置项信息"`
	Id            int64  `v:"required"`
	CategoryID    int64  `v:""`
	Name          string `v:"required"`
	Code          string `v:"required"`
	Content       string `v:""`
	Remark        string `v:""`
	IsAllowDelete int64  `v:""` // 是否允许删除：1-允许删除；0-不允许删除
}
type ConfigUpdateRes struct {
}

type ConfigDeleteReq struct {
	g.Meta `path:"/system/config/delete" tags:"系统管理-配置项" method:"post" summary:"删除" description:"删除系统配置项"`
	Id     int64 `v:"required"`
}
type ConfigDeleteRes struct {
}

type ConfigListReq struct {
	g.Meta `path:"/system/config/list" tags:"系统管理-配置项" method:"GET" summary:"列表" description:"配置项列表"`
	api.PagerReq
	CategoryID int64  `v:""`
	Code       string `dc:"标识符"`
	Name       string `dc:"名称"`
}
type ConfigListRes struct {
	api.PagerRes
}

type ConfigMapReq struct {
	g.Meta `path:"/system/config/map" tags:"系统管理-配置项" method:"GET" summary:"根据标识符获取配置信息" description:"根据配置项标识符查询相关配置信息"`
	Codes  []string `dc:"标识符"`
}
type ConfigMapRes struct {
	Data interface{} `json:"data"`
}
type ConfigDetailReq struct {
	g.Meta `path:"/system/config/detail" tags:"系统管理-配置项" method:"GET" summary:"详情" description:"根据配置项标识符查询相关配置信息"`
	Code   string `v:"required" dc:"标识符"`
}
type ConfigDetailRes struct {
	Detail interface{} `json:"detail"`
}

type ConfigFlushCacheReq struct {
	g.Meta `path:"/system/config/flushCache" tags:"系统管理-配置项" method:"POST" summary:"刷新所有缓存" description:"根据配置项标识符查询缓存值"`
	Codes  []string `dc:"标识符"`
}
type ConfigFlushCacheRes struct{}

type ConfigCacheContentReq struct {
	g.Meta `path:"/system/config/cacheContent" tags:"系统管理-配置项" method:"GET" summary:"缓存值" description:"根据配置项标识符查询缓存值"`
	Code   string `dc:"标识符"`
}
type ConfigCacheContentRes struct {
	Content string `json:"content" dc:"配置项值"`
}

type ConfigAdminWebsiteReq struct {
	g.Meta `path:"/system/config/adminWebsite" tags:"系统管理-配置项" method:"GET" summary:"缓存值" description:"根据配置项标识符查询缓存值"`
	Code   string `dc:"标识符"`
}
type ConfigAdminWebsiteRes struct {
	Result model.AdminWebsiteData `json:"result" dc:"配置项值"`
}
